#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
class Solution1 {
public:
    bool CheckPermutation(string s1, string s2) {
        int hash[27] = { 0 };
        if (s1.size() != s2.size())return false;
        for (int i = 0; i < s1.size(); i++)
        {
            hash[s1[i] - 'a']++;
        }

        for (int i = 0; i < s2.size(); i++)
        {
            if (hash[s2[i] - 'a'] == 0)return false;
            hash[s2[i] - 'a']--;
        }
        return true;
    }
};

class Solution2 {
public:
    bool CheckPermutation(string s1, string s2) {
        sort(s1.begin(), s1.end());
        sort(s2.begin(), s2.end());
        if (s1 == s2)return true;
        return false;
    }
};